<script type="text/javascript">
    $(function() {
        getPage();
        var tags = $("#modal_tags").attr('data-tags');
        var arr = tags.split(",");
        arr = uniQueue(clearEmptyArr(arr));
        var len = arr.length;
        if (len > 0) {
            for (var i = 0; i < len; i++) {
                var id = arr[i];
                $('#box_id_' + id).prop("checked", "checked");
            }
        }
    })
    function getPage() {
        $(".pager a").click(function() {
            var href = $(this).attr("data-href");
            var keyword = $("#keyword_box").val();
            $.get(href, {keyword: keyword
            }, function(data) {
                $('#ajax_lists').html(data);
            })
        })
    }
    function getSearch() {
        var keyword = $("#keyword_box").val();
        $.get("{:U('Box/tags_lists')}", {
            keyword: keyword
        }, function(data) {
            $('#ajax_lists').html(data);
        })
    }
    function tags_add() {
        var name = $("#name").val();
        $.get("{:U('Box/tags_add')}", {
            name:name,
            ord:$("#ord").val(),
            id:"{$id}"
        }, function(data) {
           
        })
    }
</script>
<div class="header smaller lighter blue clearfix">
    <div style="float:left">
        <input type="text" class="form-control" id="name" placeholder="请输入名称"/>
        <input type="text" class="form-control" id="ord" placeholder="0" style="width:45px"/><a class="btn btn-info btn-sm" onclick="tags_add()">增加</a>
    </div>
    <div class="search_area">

        <input class="form-control search-query" type="text" id="keyword_box" autocomplete="off"  placeholder="请输入搜索关键词" value="{$keyword}"><button class="btn btn-purple btn-sm" type="button" onclick="getSearch()">搜 索 <i class="icon_search icon-on-right bigger-110"></i></button>
    </div>

    <div class='cl'></div>
</div>
<div class="table-responsive" >
    <notempty name='lists'>
        <table class="table table-striped table-bordered table-hover">
            <thead>
                <tr>
                    <th class="center" width='45px'>选择</th>
                    <th width='45px' class="center">序号</th>
                    <th>名称</th>
                    <th>排序</th>
                </tr>
            </thead>
            <tbody>
            <foreach name="lists" item="row">
                <tr>
                    <td class="center">
                        <label><input type="checkbox" id="box_id_{$row.id}" onclick="checkTags($(this))" class="ace" name="dels2" value="{$row.id}" autocomplete="off" /><span class="lbl"></span></label>
                    </td>
                    <td  class="center">{$key+1|getPageKey}</td>
                    <td class="name">{$row.name}</td>
                    <td><a onclick="changeOrd($(this), 'modals_tags', '{$row.id}')">{$row.ord}</a></td>
                </tr>
            </foreach>
            </tbody>
        </table>
        <else/>
        <p class='noempty'>没有符合条件的记录！</p>
    </notempty>
</div>
<div class="pager" style="margin:30px 0 0 0">{$page}</div>